package com.nstar.countdown.view.modules.impl
{
	import com.jwopitz.containers.TileCanvas;
	import com.nstar.base.util.Logger;
	import com.nstar.countdown.view.components.CountDownPanelSimple;
	import com.nstar.hacocwebfx.model.business.LoadXMLDelegate;
	
	import mx.events.FlexEvent;
	import mx.modules.Module;
	import mx.rpc.IResponder;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.mxml.RemoteObject;

	public class TradtionalClass extends Module  implements IResponder
	{
		public var tc:TileCanvas;
		public var countDown:RemoteObject;
		
		private var url:String;
		private var cdps:CountDownPanelSimple;
		
		private var logger:Logger = Logger.getInstance(this);
				
		public function TradtionalClass()
		{
			super();
			this.addEventListener(FlexEvent.CREATION_COMPLETE,init);			
		}
		
		private function init(event:FlexEvent):void{
			
			countDown.addEventListener(ResultEvent.RESULT,resultHandler);
			countDown.addEventListener(FaultEvent.FAULT,faultHandler);
		}
		
		private function resultHandler(event:ResultEvent):void{
			
		}
		
		private function faultHandler(event:FaultEvent):void{
			logger.debugMore("fault",event.fault);
		}
		
		public function load(url:String="demo/data/tradtional.xml"):void{
			this.url = url;
			var delegate : LoadXMLDelegate = new LoadXMLDelegate(this, url, "object");
			delegate.load();
		}
		
		public function result( rpcEvent : Object ) : void
		{
			tc.dataProvider = rpcEvent.result.dataconfig.item;
		}
		
		public function fault( rpcEvent : Object ) : void 
		{
			logger.debugMore("fault",rpcEvent.fault);
		}		
	}
}